package cn.fintecher.pangolin.entity.elastic;

import cn.fintecher.pangolin.common.enums.*;
import cn.fintecher.pangolin.common.utils.Constants;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;

import java.util.Date;

/**
 * @Auther: xiaqun
 * @Description: 客户联系人实体
 * @Date: 18:22 2019/8/28
 */

@Data
@Document(indexName = Constants.PERSONAL_CONTACT, type = Constants.PERSONAL_CONTACT, shards = 1, replicas = 0)
@ApiModel(value = "客户联系人实体", description = "客户联系人实体")
public class PersonalContact {
    @ApiModelProperty(value = "主键ID")
    @Id
    private String id;

    @ApiModelProperty(value = "案件ID")
    private String caseId;

    @ApiModelProperty(value = "案件编号")
    private String caseNumber;

    @ApiModelProperty(value = "证件号")
    private String certificateNo;

    @ApiModelProperty(value = "姓名")
    private String name;

    @ApiModelProperty(value = "关系")
    private cn.fintecher.pangolin.common.enums.Relationship relation;

    @ApiModelProperty(value = "电话号码")
    private String phoneNo;

    @ApiModelProperty(value = "电话类型")
    private PhoneType type;

    @ApiModelProperty(value = "电话状态")
    private ContactStatus status;

    @ApiModelProperty(value = "联络结果")
    private String contactResult;

    @ApiModelProperty(value = "来源")
    private Source source;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "拨打电话次数")
    private Integer dialPhoneCount;

    @ApiModelProperty(value = "短信发送次数")
    private Integer sendMessageCount;

    @ApiModelProperty(value = "启用状态")
    private BaseStatus isEnable;

    @ApiModelProperty(value = "委托方ID")
    private String principalId;

    @ApiModelProperty(value = "创建人ID")
    private String operatorId;

    @ApiModelProperty(value = "创建时间")
    private Date operateTime;

    @ApiModelProperty(value = "更新人ID")
    private String updaterId;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    public void process(String id, Date date, boolean flag) {
        if (flag) {
            this.operatorId = id;
            this.operateTime = date;
        }
        this.updaterId = id;
        this.updateTime = date;
    }
}
